package com.ruoyi.be.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.be.domain.MedicalCpoexx;
import com.ruoyi.be.service.IMedicalCpoexxService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 病房记录Controller
 * 
 * @author ruoyi
 * @date 2022-01-08
 */
@RestController
@RequestMapping("/be/xx")
public class MedicalCpoexxController extends BaseController
{
    @Autowired
    private IMedicalCpoexxService medicalCpoexxService;

    /**
     * 查询病房记录列表
     */
    @PreAuthorize("@ss.hasPermi('be:xx:list')")
    @GetMapping("/list")
    public TableDataInfo list(MedicalCpoexx medicalCpoexx)
    {
        startPage();
        List<MedicalCpoexx> list = medicalCpoexxService.selectMedicalCpoexxList(medicalCpoexx);
        return getDataTable(list);
    }

    /**
     * 导出病房记录列表
     */
    @PreAuthorize("@ss.hasPermi('be:xx:export')")
    @Log(title = "病房记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, MedicalCpoexx medicalCpoexx)
    {
        List<MedicalCpoexx> list = medicalCpoexxService.selectMedicalCpoexxList(medicalCpoexx);
        ExcelUtil<MedicalCpoexx> util = new ExcelUtil<MedicalCpoexx>(MedicalCpoexx.class);
        util.exportExcel(response, list, "病房记录数据");
    }

    /**
     * 获取病房记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('be:xx:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(medicalCpoexxService.selectMedicalCpoexxById(id));
    }

    /**
     * 新增病房记录
     */
    @PreAuthorize("@ss.hasPermi('be:xx:add')")
    @Log(title = "病房记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody MedicalCpoexx medicalCpoexx)
    {
        return toAjax(medicalCpoexxService.insertMedicalCpoexx(medicalCpoexx));
    }

    /**
     * 修改病房记录
     */
    @PreAuthorize("@ss.hasPermi('be:xx:edit')")
    @Log(title = "病房记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody MedicalCpoexx medicalCpoexx)
    {
        return toAjax(medicalCpoexxService.updateMedicalCpoexx(medicalCpoexx));
    }

    /**
     * 删除病房记录
     */
    @PreAuthorize("@ss.hasPermi('be:xx:remove')")
    @Log(title = "病房记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(medicalCpoexxService.deleteMedicalCpoexxByIds(ids));
    }
}
